package com.dhp.Utils;

import com.dhp.constant.GenChartConstant;
import com.yupi.yucongming.dev.client.YuCongMingClient;
import com.yupi.yucongming.dev.common.BaseResponse;
import com.yupi.yucongming.dev.model.DevChatRequest;
import com.yupi.yucongming.dev.model.DevChatResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class AIUtil {

    @Autowired
    private YuCongMingClient yuCongMingClient;

    public String doChat(String request){
        DevChatRequest devChatRequest = new DevChatRequest();
        devChatRequest.setModelId(GenChartConstant.AI_ID);
        devChatRequest.setMessage(request);

        BaseResponse<DevChatResponse> devChatResponseBaseResponse = yuCongMingClient.doChat(devChatRequest);

        return devChatResponseBaseResponse.getData().getContent();
    }

}
